<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
     /* 重置浏览器默认样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f7f7f7;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 960px; /* 你可以根据需要调整这个值 */
    margin: 30px auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th, td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #5cb85c;
    color: white;
}

input[type="text"] {
    width: calc(100% - 22px);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="button"] {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background-color: #337ab7;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

input[type="button"]:hover {
    background-color: #286090;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 10px;
    }
}
    </style>
</head>
<body>
<div class="container">
	<table>
		<tr>
			<td><label for="providerName">供应商名称</label></td>
			<td><input type="text" name="providerName" id="providerName"></td>
		</tr>
		<tr>
			<td colspan="2"><input type="button" value="提交" id="sub"></td>
		</tr>
	</table>
</div>
<script src="../js/jquery.min.js"></script>
<script src="../js/layer/layer.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#sub").click(function(){
			var providerName = $("#providerName").val();
			$.post("AdminAddProviderServlet",{
				providerName:providerName
			},function(data){
				if(data=="OK"){
					layer.msg("添加成功");
					setTimeout("move()",2000);
				}
				if(data=="Error"){
					layer.msg("添加失败");
				}
				if(data=="Error2"){
					layer.msg("您的输入有误，编号只能为整数");
				}
				if(data=="Error3"){
					layer.msg("供应商编号或供应商名称已存在");
				}
			})
		})
	})
	function move(){
		window.location.href="AdminProviderServlet";
	}
</script>
</body>
</html>